export const constantRoutes = [
  {
    path: "/",
    name: "Layout",
    component: () => import("@/views/Layout/index.vue"),
    children: [
      {
        //默认二级路由 当页面在/时候 自动跳转到home页面
        path: "",
        name: "Home",
        component: () => import("@/views/Home/index.vue"),
      },
      {
        // 分类 跳转带参数 params
        path: "category/:id",
        name: "Category",
        component: () => import("@/views/Category/index.vue"),
      },
      // {
      //   // 分类 跳转带参数 query
      //   path: "category",
      //   name: "Category",
      //   component: () => import("@/views/Category/index.vue"),
      // },
      {
        // 分类 跳转带参数 params
        path: "category/sub/:id",
        name: "SubCategory",
        component: () => import("@/views/SubCategory/index.vue"),
      },
      {
        path: "/detail/:id",
        name: "Detail",
        component: () => import("@/views/Detail/index.vue"),
      },
      {
        path: "cartlist",
        name: "CartList",
        component: () => import("@/views/CartList/index.vue"),
      },
      // {
      //   path: "cartlist",
      //   name: "ShopCart",
      //   component: () => import("@/views/ShopCart/index.vue"),
      // },
      {
        path: "checkout",
        component: () => import("@/views/Checkout/index.vue"),
      },
      {
        path: "pay",
        name: "Pay",
        component: () => import("@/views/Pay/index.vue"),
      },
      {
        path: "member", //个人中心
        name: "Member",
        component: () => import("@/views/PersonalCenter/index.vue"),
        // redirect: "member/user",
        //redirect: "member/user"或着子组件user路径为空path:""
        //子组件user路径为空path:"",将index.vue路由跳转改为 <router-link to="/member">个人中心</router-link>
        children: [
          {
            path: "",
            component: () =>
              import("@/views/PersonalCenter/components/MyCenter.vue"),
          },
          {
            path: "order",
            component: () =>
              import("@/views/PersonalCenter/components/MyOrder.vue"),
          },
        ],
      },
    ],
  },
  {
    path: "/login",
    name: "Login",
    component: () => import("@/views/Login/index.vue"),
  },
];
